<{css src="member.css" app='b2c'}>
<{include file="site/common/header.html" app="b2c"}>
<div class="member-main">
    <div>
       <div class="title">
	   <span style="float:left"><{t}>合作伙伴列表<{/t}>
	   <span class="disc">|</span> 
	   <span id='add' class="disc add-icon" ><a href="javascript:void(0);" ><{t}>添加合作伙伴<{/t}></a></span>
	   </span>
	   </div>
	   <!------------------>
	   <div id='add_div' <{if !$link_id}>style="display:none"<{/if}>>
            <form method="post" action="<{link app=business ctl=site_partner act=save}>">
                <div class="division" style="border:none; border-bottom:1px dashed #ddd">
                    <table cellpadding="0" class="forform" cellspacing="0" border="0">
                        <tr>
                        <th><{t}>链接名称：<{/t}></th><td><{if !$link_id}><{input type="text" class="inputstyle" name="link_name" id="link_name" style="width:120px" required="true" value=$link_name}><span id="check"></span>
						  <{else}>
						 <input type="text" name="link_name" id="link_name" style="width:120px" required="true" value=<{$link_name}>
						   ><span id="check"></span>
                           <{input type="hidden" name="link_id" value=$link_id}>
						<{/if}></td></tr>
                        <tr><th><{t}>友情链接图片：<{/t}></th><td><{input type='vimage' class="inputstyle" name='image_url' width=150 height=100 value=$image_url}></td></tr>
                        <tr><th><{t}>链接地址：<{/t}></th><td><{input type="text" name="href" class="inputstyle" id="href" value='' width='400px' height='200px' value=$href}></td></tr>
                    </table>
                </div>
                <div style="padding-left:142px; "><span class="float-span" >
                        <{button class="btn submit-btn" type="submit" rel="_request" label=$___b2c="保存"|t:'b2c'}></span>
                    <span class="float-span" style="float:left; margin-left:8px">
                        <{button id="unset" type="button" label=$___b2c="取消"|t:'b2c'}></span>
                </div>
            </form>
        </div>
		<!------>

        <table class="gridlist border-all mt10" width="100%" border="0" cellspacing="0" cellpadding="0" style="table-layout:fixed;">
            <tr>
                <th><{t}>链接名称<{/t}></th>
				<th><{t}>链接地址<{/t}></th>
				<th><{t}>友情链接图片<{/t}></th>
                <th><{t}>操作<{/t}></th>
            </tr>
           <{foreach from=$data item=data key=key}>
            <tbody>
                <tr> 
                    <td class="textcenter"><{$data.link_name}></td>
					<td class="textcenter"><{$data.href}></td>
					<td class="textcenter"><img src="<{$data.image_url}>" width="50px" height="50px"/></td>
                    <td align="center"><a href="<{link app=business ctl=site_partner act=partner_manage arg0=$pager.current arg1=$data.link_id}>">编辑</a>&nbsp;&nbsp;&nbsp;&nbsp;<a  href="javascript:move(<{$data.link_id}>);">删除</a>
					</td>
                </tr>
            </tbody>
		<{/foreach}>
        </table>
<div style="float:right"><{pagers data=$pager}></div>
     </div>
</div>
<script>
$("add").addEvent('click',function(e){      
                $('add_div').setStyle('display','inline');
});
$("unset").addEvent('click',function(e){
            $('add_div').setStyle('display','none');
        });
 function a(url,options){
        if(!url) return;
        options = Object.append({
            width:window.getSize().x*0.8,
            height:window.getSize().y*0.8
        },options||{});
        var params = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width={width},height={height}';
        params = params.substitute(options);

        window.open(url,'_blank',params);
    }
function move(link_id){
     Ex_Dialog.confirm('<{t}>确定要删除吗？<{/t}>', function(e){
		if(!e) return;
		new Request.JSON({
			url:"<{link app=business ctl='site_partner' act='move'}>",
			data:'link_id='+link_id,
			method:'POST',
			onSuccess:function(rs){
			
			  Ex_Dialog.alert(rs.message);
			
			  window.location.reload();
			}
		  }).send();
	});

}

</script>